package com.kystar.muxplayer.protocol.code.get;

import com.kystar.muxplayer.model.Preset;
import com.kystar.muxplayer.protocol.CodeCmd;

public class CG91_Preset extends CodeCmd {
//    1	当前使用的预设模式
//    2	所有预设模式状态
    private CG91_Preset(int type) {
        super(type);
    }

    @Override
    public byte getCode() {
        return (byte) 0x91;
    }



    public Preset[] getPresets() {
        Preset[] presets = new Preset[32];
        for (int i = 0; i < 4; i++) {
            byte b = mResult[i+1];
            for (int j = 0; j < 8; j++) {
                presets[i*8+j] = new Preset(i*8+j+1,(b>>j & 1) == 1);
            }
        }
        return presets;
    }

    public int getPresetId() {
        return mResult[1]&0xff;
    }


    public static CG91_Preset createCurrentPreset() {
        return new CG91_Preset(1);
    }

    public static CG91_Preset createPresetList() {
        return new CG91_Preset(2);
    }
}
